import axios from "../../utils/axios";
import api from "../../api";

export function freshList(data) {
    return new Promise((reslove, reject) => {
        axios({
            url: api.StaffManage.employeeList.GET_EMPLOYEE_LIST,
            method: 'get',
            params: data
        }).then((res) => {
            reslove(res.data)
        }).catch(err => {
            reject(err)
        })
    })
}
export function upState(params) {
    console.log(params);
    return new Promise((reslove, reject) => {
        axios({
            url: api.StaffManage.employeeList.UP_EMPLOYEE_STATE,
            method: 'post',
            params
        }).then((res) => {
            reslove(res.data)
        }).catch(err => {
            reject(err)
        })
    })
}
export function upList(data) {
    return new Promise((reslove, reject) => {
        axios({
            url: api.StaffManage.employeeList.UP_EMPLOYEE_INFO,
            method: 'post',
            data
        }).then((res) => {
            reslove(res.data)
        }).catch(err => {
            reject(err)
        })
    })
}
export function delList(params) {
    return new Promise((reslove, reject) => {
        axios({
            url: api.StaffManage.employeeList.DEL_EMPLOYEE,
            method: 'post',
            params
        }).then((res) => {
            reslove(res.data)
        }).catch(err => {
            reject(err)
        })
    })
}
export function searchList(data) {
    console.log(data);
    return new Promise((reslove, reject) => {
        axios({
            url: api.StaffManage.employeeList.GET_EMPLOYEE_BYINFO,
            params: data
        }).then((res) => {
            reslove(res.data)
        }).catch(err => {
            reject(err)
        })
    })
}
export function addList(data) {
    console.log(data);
    return new Promise((reslove, reject) => {
        axios({
            url: api.StaffManage.employeeList.ADD_EMPLOYEE,
            method: 'post',
            data
        }).then((res) => {
            reslove(res.data)
        }).catch(err => {
            reject(err)
        })
    })
}

